/**
*      author: Y_Yao
*      created: 2025-03-26 17:47:25
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 9e18;
const int INF = 0x3f3f3f3f;
const int N = 2e3 + 6;
int n;
unordered_map<int,unordered_map<int,bool>> mp;
int x[N],y[N];

void solve()
{
    cin >> n;
    for(int i = 1;i <= n;i++)
    {
        cin >> x[i] >> y[i];
        mp[x[i]][y[i]] = true;
    }

    int ans = 0;
    for(int i = 1;i <= n ;i++)
    {
        for(int j = 1;j <= n;j++)
        {
            if(i == j) continue;
            if(mp[x[i]][y[i]] && mp[x[j]][y[j]] && mp[x[i]][y[j]] && mp[x[j]][y[i]] && x[i] < x[j] && y[i] < y[j])
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}